/*
 * @Description: 模拟数据
 * @Version: 1.0
 * @Autor: wq
 * @Date: 2021-09-06 19:56:00
 * @LastEditors: wq
 * @LastEditTime: 2021-09-06 22:35:45
 */
// const objModel = [
//   {
//     id: "1450518493282832384",
//     name: "中电二所制绒右侧上料盒自动化02#",
//     total: 200,
//     groupNameA: "A",
//     groupCountA: 100,
//     groupCountB: 100,
//     gn1: "总气压异常",
//     gn2: "堵片报警",
//     gn3: "吸片2位",
//     gn4: "吸片3位",
//     gn5: "校正位漫反射",
//     gn6: "装片位",
//     num1: 1,
//     num2: 881,
//     num3: 1,
//     num4: 2,
//     num5: 3,
//     num6: 4,
//   },
//   {
//     id: "1450518493282832384",
//     name: "中电二所制绒右侧上料盒自动化02#",
//     alarmTypeName: "报警统计",
//     total: 200,
//     groupNameA: "B",
//     groupCountA: 100,
//     groupCountB: 100,
//     gn1: "总气压异常",
//     gn2: "堵片报警",
//     gn3: "吸片2位",
//     gn4: "吸片3位",
//     gn5: "校正位漫反射",
//     gn6: "装片位",
//     num1: 1,
//     num2: 881,
//     num3: 1,
//     num4: 2,
//     num5: 3,
//     num6: 4,
//   },
// ];

const alerm = [
  {
    id: "1450518193805332480",
    name: "中电二所制绒左侧上料盒自动化02#",
    alarmType: 5,
    alarmTypeName: "报警统计",
    startTime: "2021-07-01T00:00:00+08:00",
    endTime: "2021-09-02T00:00:00+08:00",
    datas: [
      {
        groupName: "A",
        count: "416",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "416",
            datas: [
              {
                groupName: "吸片2位",
                count: "1",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "2",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "32",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
          {
            groupName: "堵片报警2",
            count: "316",
            datas: [
              {
                groupName: "吸片2位",
                count: "11",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "21",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "31",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "41",
                datas: null,
              },
            ],
          },
        ],
      },
      {
        groupName: "B",
        count: "0",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "416",
            datas: [
              {
                groupName: "吸片2位",
                count: "10",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "20",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "32",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
    ],
  },
  {
    id: "1450518493282832384",
    name: "中电二所制绒右侧上料盒自动化02#",
    alarmType: 5,
    alarmTypeName: "报警统计",
    startTime: "2021-07-01T00:00:00+08:00",
    endTime: "2021-09-02T00:00:00+08:00",
    datas: [
      {
        groupName: "A",
        count: "54",
        datas: [
          {
            groupName: "总气压异常",
            count: "110",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "881",
            datas: [
              {
                groupName: "吸片2位",
                count: "2",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "20",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "4",
                datas: null,
              },
            ],
          },
        ],
      },
      {
        groupName: "B",
        count: "827",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "881",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "20",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
    ],
  },
  {
    id: "1445152451891171328",
    name: "中电二所制绒左侧上料盒自动化07#",
    alarmType: 5,
    alarmTypeName: "报警统计",
    startTime: "2021-07-01T00:00:00+08:00",
    endTime: "2021-09-02T00:00:00+08:00",
    datas: [
      {
        groupName: "A",
        count: "1243",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "1243",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "24",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
      {
        groupName: "B",
        count: "0",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "1243",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "24",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
    ],
  },
  {
    id: "1450519197766520832",
    name: "中电二所制绒右侧上料盒自动化03#",
    alarmType: 5,
    alarmTypeName: "报警统计",
    startTime: "2021-07-01T00:00:00+08:00",
    endTime: "2021-09-02T00:00:00+08:00",
    datas: [
      {
        groupName: "A",
        count: "144",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "1171",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "48",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
      {
        groupName: "B",
        count: "1027",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "1171",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "48",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
    ],
  },
  {
    id: "1450519325072035840",
    name: "中电二所制绒左侧上料盒自动化04#",
    alarmType: 5,
    alarmTypeName: "报警统计",
    startTime: "2021-07-01T00:00:00+08:00",
    endTime: "2021-09-02T00:00:00+08:00",
    datas: [
      {
        groupName: "A",
        count: "1225",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "1225",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "40",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
      {
        groupName: "B",
        count: "0",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "1225",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "40",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
    ],
  },
  {
    id: "1450519397528637440",
    name: "中电二所制绒右侧上料盒自动化04#",
    alarmType: 5,
    alarmTypeName: "报警统计",
    startTime: "2021-07-01T00:00:00+08:00",
    endTime: "2021-09-02T00:00:00+08:00",
    datas: [
      {
        groupName: "A",
        count: "80",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "807",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "18",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
      {
        groupName: "B",
        count: "727",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "807",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "18",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
    ],
  },
  {
    id: "1436934202108022784",
    name: "中电二所制绒左侧上料盒自动化01#",
    alarmType: 5,
    alarmTypeName: "报警统计",
    startTime: "2021-07-01T00:00:00+08:00",
    endTime: "2021-09-02T00:00:00+08:00",
    datas: [
      {
        groupName: "A",
        count: "1283",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "1283",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "59",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
      {
        groupName: "B",
        count: "0",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "1283",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "59",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
    ],
  },
  {
    id: "1436934478760120320",
    name: "中电二所制绒右侧上料盒自动化01#",
    alarmType: 5,
    alarmTypeName: "报警统计",
    startTime: "2021-07-01T00:00:00+08:00",
    endTime: "2021-09-02T00:00:00+08:00",
    datas: [
      {
        groupName: "A",
        count: "76",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "689",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "59",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
      {
        groupName: "B",
        count: "613",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "689",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "59",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
    ],
  },
  {
    id: "1436936010574467072",
    name: "中电二所制绒右侧上料盒自动化05#",
    alarmType: 5,
    alarmTypeName: "报警统计",
    startTime: "2021-07-01T00:00:00+08:00",
    endTime: "2021-09-02T00:00:00+08:00",
    datas: [
      {
        groupName: "A",
        count: "71",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "1232",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "43",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
      {
        groupName: "B",
        count: "1161",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "1232",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "43",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
    ],
  },
  {
    id: "1436935839048404992",
    name: "中电二所制绒左侧上料盒自动化05#",
    alarmType: 5,
    alarmTypeName: "报警统计",
    startTime: "2021-07-01T00:00:00+08:00",
    endTime: "2021-09-02T00:00:00+08:00",
    datas: [
      {
        groupName: "A",
        count: "953",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "953",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "92",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
      {
        groupName: "B",
        count: "0",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "953",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "92",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
    ],
  },
  {
    id: "1450519584531681280",
    name: "中电二所制绒左侧上料盒自动化06#",
    alarmType: 5,
    alarmTypeName: "报警统计",
    startTime: "2021-07-01T00:00:00+08:00",
    endTime: "2021-09-02T00:00:00+08:00",
    datas: [
      {
        groupName: "A",
        count: "647",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "647",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "48",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
      {
        groupName: "B",
        count: "0",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "647",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "48",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
    ],
  },
  {
    id: "1450519652001255424",
    name: "中电二所制绒右侧上料盒自动化06#",
    alarmType: 5,
    alarmTypeName: "报警统计",
    startTime: "2021-07-01T00:00:00+08:00",
    endTime: "2021-09-02T00:00:00+08:00",
    datas: [
      {
        groupName: "A",
        count: "2",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "1041",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "47",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
      {
        groupName: "B",
        count: "1039",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "1041",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "47",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
    ],
  },
  {
    id: "1450519849603305472",
    name: "中电二所制绒左侧上料盒自动化08#",
    alarmType: 5,
    alarmTypeName: "报警统计",
    startTime: "2021-07-01T00:00:00+08:00",
    endTime: "2021-09-02T00:00:00+08:00",
    datas: [
      {
        groupName: "A",
        count: "978",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "978",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "59",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
      {
        groupName: "B",
        count: "0",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "978",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "59",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
    ],
  },
  {
    id: "1450519911125356544",
    name: "中电二所制绒右侧上料盒自动化08#",
    alarmType: 5,
    alarmTypeName: "报警统计",
    startTime: "2021-07-01T00:00:00+08:00",
    endTime: "2021-09-02T00:00:00+08:00",
    datas: [
      {
        groupName: "A",
        count: "114",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "510",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "31",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
      {
        groupName: "B",
        count: "396",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "510",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "31",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
    ],
  },
  {
    id: "1445152960639275008",
    name: "中电二所制绒右侧上料盒自动化07#",
    alarmType: 5,
    alarmTypeName: "报警统计",
    startTime: "2021-07-01T00:00:00+08:00",
    endTime: "2021-09-02T00:00:00+08:00",
    datas: [
      {
        groupName: "A",
        count: "68",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "675",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "52",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
      {
        groupName: "B",
        count: "607",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "675",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "52",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
    ],
  },
  {
    id: "1450519087338885120",
    name: "中电二所制绒左侧上料盒自动化03#",
    alarmType: 5,
    alarmTypeName: "报警统计",
    startTime: "2021-07-01T00:00:00+08:00",
    endTime: "2021-09-02T00:00:00+08:00",
    datas: [
      {
        groupName: "A",
        count: "1587",
        datas: [
          {
            groupName: "总气压异常",
            count: "0",
            datas: [],
          },
          {
            groupName: "堵片报警",
            count: "1587",
            datas: [
              {
                groupName: "吸片2位",
                count: "0",
                datas: null,
              },
              {
                groupName: "吸片3位",
                count: "0",
                datas: null,
              },
              {
                groupName: "校正位漫反射",
                count: "84",
                datas: null,
              },
              {
                groupName: "装片位",
                count: "0",
                datas: null,
              },
            ],
          },
        ],
      },
    ],
  },
];

// 定义一个数组，处理后的
const tempArr = [];
for (let i = 0; i < alerm.length; i++) {
  const jLen = alerm[i].datas;
  let total = 0;
  for (let j = 0; j < jLen.length; j++) {
    total += Number(jLen[j].count); // 计算 A + B 侧总合
    alerm[i].total = total;
    if (jLen.length > 1) {
      // console.log('A + B 侧和', jLen[j]);
      if (jLen[j].groupName && jLen[j].groupName.includes("A")) {
        alerm[i].totalA = jLen[j].count;
      }
      if (jLen[j].groupName && jLen[j].groupName.includes("B")) {
        alerm[i].totalB = jLen[j].count;
      }
    } else if (jLen.length > 0) {
      // console.log('A + B 侧和', jLen[j]);
      if (jLen[j].groupName && jLen[j].groupName.includes("A")) {
        alerm[i].totalA = jLen[j].count;
        alerm[i].totalB = 0;
      }
      if (jLen[j].groupName && jLen[j].groupName.includes("B")) {
        alerm[i].totalB = jLen[j].count;
        alerm[i].totalA = 0;
      }
    } else {
      alerm[i].totalA = 0;
      alerm[i].totalB = 0;
    }
  }
}
// console.log('第1次处理后数据：', alerm);

// 先判断有没有 A, B侧，如果有A,B侧 需要将一个对象拆分为 A,B 2 个对象
for (let i = 0; i < alerm.length; i++) {
  // 有 A, B侧
  if (alerm[i].datas.length > 1) {
    for (let j = 0; j < alerm[i].datas.length; j++) {
      alerm[i]["ids"] = alerm[i]["id"] + "-" + i + j;
      tempArr.push({
        groupData: alerm[i].datas[j].datas,
        groupName: alerm[i].datas[j].groupName,
        ...alerm[i],
      });
    }
  }
  // 只有一侧
  if (alerm[i].datas.length === 1) {
    alerm[i]["ids"] = alerm[i]["id"] + "-" + i;
    tempArr.push({
      groupData: alerm[i].datas[0].datas,
      groupName: alerm[i].datas[0].groupName,
      ...alerm[i],
    });
  }
}
// console.log('第二次处理后数据：', tempArr);

// 第3次处理数据格式
// 去除一些无用属性
const deletProperty = [
  "datas",
  "groupData",
  "startTime",
  "endTime",
  "alarmType",
];
for (let i = 0; i < tempArr.length; i++) {
  const item = tempArr[i];
  for (let j = 0; j < item.groupData.length; j++) {
    item[`pr-name-${j}`] = item.groupData[j].groupName;
    item[`pr-num-${j}`] = item.groupData[j].count;
    item[`cusData${j}`] = item.groupData[j].datas;
    // 额外加一个for 循环
    if (item.groupData[j].datas.length > 0) {
      for (let z = 0; z < item.groupData[j].datas.length; z++) {
        item.groupData[j].datas[z]['index'] = `count-${z + 1}`
      }
    } else {
      // console.log('不进行循环操作')
    }
  }
  for (let key in item) {
    if (key && key.includes("cusData")) {
      if (item[key] && item[key].length > 0) {
        for (let k = 0; k < item[key].length; k++) {
          // 新增地属性 应该在原来属性索引后面
          item[`gn-${k + 1}`] = item[key][k].groupName;
          item[`count-${k + 1}`] = item[key][k].count;
        }
      }
    }
    // if (deletProperty.includes(key) || key.includes("cusData")) {
    if (deletProperty.includes(key)) {
      delete item[key];
    }
  }
}
//   console.table("最终处理后数据：", tempArr);

export { tempArr };
